SA-MP Forums Archive
help please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help please (/showthread.php?tid=210215)



help please - darkknight123 - 12.01.2011

im trying to script this command

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
if (strcmp("/asslick", cmdtext, true))
{
new tmp[30];
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, 0x919191FF, "Usage: /asslick [id]");
if(IsPlayerConnected(otherplayer))
{
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), " %s Is now asslicking %d", name);
SendClientMessageToAll(0x33CCFFAA, string);
SendClientMessage(playerid,0xFFFFFFFF,"Heres 1 Doller for your trubles ");
GivePlayerMoney(playerid, 1);
SendClientMessage(playerid,0xFFFFFFFF,"wait never mind I want that money back!");
GivePlayerMoney(playerid,-1000);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF, "Haha!, The Player you are trying to asslick isn't online! noob.");
}
return 1;
}
return 0;

but when i try it ig it works fine but is says

EX: Melek is now asslicking 1251923
and every time i try it the other player is some random number


Re: help please - iJumbo - 12.01.2011

pawn Код:
new idx;
if (strcmp("/asslick", cmdtext, true))
{
new tmp[30];
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, 0x919191FF, "Usage: /asslick [id]");
if(IsPlayerConnected(otherplayer))
{
new string[64], name[MAX_PLAYER_NAME];
new otherplayername[24];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(otherplayer, otherplayername, sizeof(otherplayername));
format(string, sizeof(string), " %s Is now asslicking %s", name,otherplayername);
SendClientMessageToAll(0x33CCFFAA, string);
SendClientMessage(playerid,0xFFFFFFFF,"Heres 1 Doller for your trubles ");
GivePlayerMoney(playerid, 1);
SendClientMessage(playerid,0xFFFFFFFF,"wait never mind I want that money back!");
GivePlayerMoney(playerid,-1000);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF, "Haha!, The Player you are trying to asslick isn't online! noob.");
}
return 1;
}
return 0;
try now i make it so fast and not tested


Re: help please - darkknight123 - 12.01.2011

now when i get ig when i try my /help command its does asslicking and when i try to asslick one person it asslick someone else


Re: help please - iJumbo - 12.01.2011

you script it bad .. into your gm/fs ..

use dcmd or zcmd .. is better


Re: help please - darkknight123 - 12.01.2011

so i need to rewrite my script just for 1 command to work? D:


Re: help please - iJumbo - 12.01.2011

use dcmd only on this command ... lol