GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: R@f le 04 Novembre 2007, 17:23:07
-
salut a tous et a toutes
j ai un petit problème avec une commande que j ai crée, c'est le /giveweapon [id] [arme] [munition]
la voici :
else if (!strcmp(cmd, "/giveweapon", true))
{
new pid,id1,id2,tmp[256],tmpp[256],tmppp[256];
tmpp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREEN, "USAGE: /giveweapon [playerid] [weapon] [ammo]");
return 1;
}
pid = strval(tmp);
if (!(IsPlayerConnected(pid)))
{
SendClientMessage(playerid, COLOR_RED, "THAT PLAYER IS NOT CONNECTED!");
return 1;
}
id1 = strval(tmpp);
id2 = strval(tmppp);
GivePlayerWeapon(pid,id1,id2);
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(tmpp, sizeof(tmpp), "[RAS]Admin %s given you a weapon (id %d ) whit %d bullets",AdminName,id1,id2);
SendClientMessage(pid,COLOR_YELLOW,tmpp);
return 1;
}
si quelqu un pourrai m'expliquer ce qui est faux sa serai sympa
merci d'avance
++
R@f
-
Je pence que c'est ça :
else if (!strcmp(cmd, "/giveweapon", true))
{
new pid,id1,id2,tmp[256],tmpp[256],tmppp[256];
---------> tmpp <--------- = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREEN, "USAGE: /giveweapon [playerid] [weapon] [ammo]");
return 1;
}
pid = strval(tmp);
if (!(IsPlayerConnected(pid)))
{
SendClientMessage(playerid, COLOR_RED, "THAT PLAYER IS NOT CONNECTED!");
return 1;
}
id1 = strval(tmpp);
id2 = strval(tmppp);
GivePlayerWeapon(pid,id1,id2);
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(tmpp, sizeof(tmpp), "[RAS]Admin %s given you a weapon (id %d ) whit %d bullets",AdminName,id1,id2);
SendClientMessage(pid,COLOR_YELLOW,tmpp);
return 1;
}
Remplace tmpp par tmp
Edit : Heuu attend, Plus de précision, T'as des erreurs ou ca ne marche pas quand tu le fais ?
-
merci je vais essayer ;)
pour les précisions : sa marchait pas quand je le fesais ;)
EDIT : j ai remarqué que j ai oublié le :
tmp= strtok(cmdtext, idx);
tmpp= strtok(cmdtext, idx);
tmppp= strtok(cmdtext, idx);
-
Et ça marche depuis ??
J'avais remarqué aussi pour les tmp / tmpp et tmppp mais après j'ais vu d'autre ligne ou ils était alors je me suis dit que l'erreur ne venais pas de la.... Effectivement si tu ne met pas la signification du code ^^ ça ne peut pas marcher ;)