Wysłany: 2014-01-17, 16:44
Pikus2
Wiek: 29 Na forum: 4698 dni Posty: 244
Piwa : 5
Witam ma tak? komende
http://pastebin.com/dhzu1Mpz
chce aby m?g? jej uzywa? admin wpisuj?c
/pkthp [id gracza]
i wyskakiwa?o by mu punkty hp tego gracza to [ilo??]pkt
a nast?pna komenda to:
mam t? komende
http://pastebin.com/fAq4BL89
chce zeby nie da?o sie wiekszego id koloru niz 300 bo moge nawet 35939593953495693469963493969.
gdy bedzie zaduzo wyswietli sie:
Id koloru jest b??dne.
Wysłany: 2014-01-17, 19:59
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Pikus2 , Pierwsza komenda:
Kod: if(strcmp(cmdtext,"/pkthp",true)==0) //
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "SERVER:/pkthp [ID gracza]");
return 1;
}
if(!IsPlayerConnected(strval(tmp)))
{
SendClientMessage(playerid, -1, "Z?e ID gracza");
return 1;
}
new Float:PlayerHP;
GetPlayerHealth(strval(tmp),PlayerHP);
new string[128];
format(string, sizeof(string), "Ilo?? ?ycia tego gracza w punktach: %.0f", PlayerHP);
SendClientMessage(playerid,COLOR_YELLOW,string);
return 1;
}
Druga komenda:
Kod: if(strcmp(cmd, "/kolory", true) == 0 && gTeam[playerid] == TEAM_POMOC){
new co1;
new co2;
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "/lakier [1-300] [1-300]");
return 1;
}
if(strval(tmp) > 300){
SendClientMessage(playerid, COLOR_YELLOW, "B??dne id koloru.");
return 1;
}
co1 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co1);
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co1);
return 1;
}
co2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co2);
return 1;
}
Wysłany: 2014-01-19, 14:34
Pikus2
Wiek: 29 Na forum: 4698 dni Posty: 244
Piwa : 5
w /lakier moge nawet wpisac /lakier 300 i dzia?a a chce zeby trzeba /lakier 300 300
i chce tez zeby mozna by?o id 0 koloru (czyli czarny)
Wysłany: 2014-01-19, 15:27
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Ju? dawno nie u?ywalem strtok i ju? po prostu zapomnia?em jak wykonywa?o si? w nim komendy. Na twoim miejscu pomy?la?bym na sscanfem oraz zcmd
Wysłany: 2014-01-19, 20:35
Pikus2
Wiek: 29 Na forum: 4698 dni Posty: 244
Piwa : 5
Zcmd odpada.
Nie lubie tego jezyku stylu jak kolwiek to nazwa?.
A co do sscanfa to pom?g? bys to jako? przerobi? bo troszeke zapomnia?em jak
Wysłany: 2014-01-20, 01:57
=X=
WUJCIO DOBRA RADA
Wiek: 52 Na forum: 4524 dni Posty: 134
SPONSOR
Piwa : 641
"Pikus2" napisał/a :w /lakier moge nawet wpisac /lakier 300 i dzia?a a chce zeby trzeba /lakier 300 300
i chce tez zeby mozna by?o id 0 koloru (czyli czarny)
Pawn /*Coded By: =X=*/
#include <a_samp>
#include <gl_common> // !
#define X_KOLOR_POJAZDU 0xFFFF00AA
#define TEAM_POMOC 1 // ?
new gTeam [ MAX_PLAYERS ];
public OnPlayerCommandText ( playerid , cmdtext [])
{
new cmd [ 128 ], idx ;
cmd = strtok ( cmdtext , idx );
if( strcmp ( "/kolory" , cmd , true ) == 0 && gTeam [ playerid ] == TEAM_POMOC )
{
if( IsPlayerInAnyVehicle ( playerid ))
{
SendClientMessage ( playerid , X_KOLOR_POJAZDU , "|Info| Dost?pne kolory |1||2| [0 - 300]" );
new X_KOLOR_A [ 128 ];
new X_KOLOR_B [ 128 ];
new POJAZD_X ;
X_KOLOR_A = strtok ( cmdtext , idx );
X_KOLOR_B = strrest ( cmdtext , idx );
POJAZD_X = GetPlayerVehicleID ( playerid );
if( strval ( X_KOLOR_A ) > 300 )
{
PlayerPlaySound ( playerid , 1055 , 0.0 , 0.0 , 0.0 );
SendClientMessage ( playerid , X_KOLOR_POJAZDU , "|Info||1| Dost?pne kolory [0 - 300]" );
return 1 ;
}
if( strval ( X_KOLOR_B ) > 300 )
{
PlayerPlaySound ( playerid , 1055 , 0.0 , 0.0 , 0.0 );
SendClientMessage ( playerid , X_KOLOR_POJAZDU , "|Info||2| Dost?pne kolory [0 - 300]" );
return 1 ;
}
else
{
PlayerPlaySound ( playerid , 1134 , 0.0 , 0.0 , 0.0 );
ChangeVehicleColor ( POJAZD_X , strval ( X_KOLOR1 ), strval ( X_KOLOR2 ));
return 1 ;
}
}
else
{
PlayerPlaySound ( playerid , 1055 , 0.0 , 0.0 , 0.0 );
SendClientMessage ( playerid , X_KOLOR_POJAZDU , "|Info| Musisz by?, w poje?dzie!" );
return 1 ;
}
}
return 0 ;
}
Wysłany: 2014-01-20, 21:22
Pikus2
Wiek: 29 Na forum: 4698 dni Posty: 244
Piwa : 5
Wysłany: 2014-01-20, 22:57
ToxiC.
Wiek: 28 Na forum: 5246 dni Posty: 3792
Piwa : 8590
Pikus2 , tyle czasu piszesz te problemy i dalej si? nie nauczy?e? nic widz?. Wystarczy pomy?le?.
Pawn
SendClientMessage ( playerid , X_KOLOR_POJAZDU , "|Info| Musisz by?, w poje?dzie!" );
Nie masz zdefiniowanych kolor?w, np wy?ej tam, X_KOLOR_POJAZDU nie jest zdefiniowane. Wystarczy ?e zamiesz to na -1
czyli:
Pawn
SendClientMessage ( playerid , - 1 , "|Info| Musisz by?, w poje?dzie!" );
zr?b tak z reszt?
Wysłany: 2014-01-21, 07:01
Pikus2
Wiek: 29 Na forum: 4698 dni Posty: 244
Piwa : 5
ToxiC` , nauczy?e,m sie ale u siebie mia?em color admina wpisany w tym i skopiowa??m t? komende z tej strony wpisa?em color admina by?y warningi wklei?em spowrotem kod ten i zapomnia?em koloru tego zmienic
P.s. Tak nie dzia?a.
[ Dodano : 2014-01-21, 07:04 ]
Cytat: if(strcmp(cmd, "/kolory", true) == 0 && gTeam[playerid] == TEAM_POMOC){
new co1;
new co2;
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "/lakier [1-300] [1-300]");
return 1;
}
if(strval(tmp) > 300){
SendClientMessage(playerid, COLOR_YELLOW, "B??dne id koloru.");
return 1;
}
if(strval(tmp) > 300){
SendClientMessage(playerid, COLOR_YELLOW, "B??dne id koloru.");
return 1;
}
co1 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co1);
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co1);
return 1;
}
co2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), co1, co2);
return 1;
}
ta komende edytnij a nie robisz now? bo ta twoja mi nie dzia?a.
Tagi: podział :: komend
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: