Larsey123IsMe
Unregistered
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/addscore", cmdtext, true, 10) == 0)
{
new tmp[256];
tmp = strtok ( cmdtext, idx );
if ( !strlen ( tmp ) )
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /addscore [ID]");
return 1;
}
new score = GetPlayerScore(playerid);
SetPlayerScore(playerid,score+1);
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s added 1 score extra to your account.",name); //sends that message only to the plyer who got the score... %s is meant to say the Playername + ID of who added the score to him
SendClientMessageToAll(0xFFFF00AA, string);
return 1;
}
return 0;
}
Example: Larsey123 added 1 score extra to your account
Larsey123IsMe
Unregistered
pawn Код:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/addscore", cmdtext, true, 10) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx); //Line 8
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /addscore [playerid]");
if(IsPlayerConnected(strval(tmp)))
{
new score = GetPlayerScore(strval(tmp));
SetPlayerScore(strval(tmp),score+1);
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s added 1 score extra to your account.",name);
SendClientMessage(strval(tmp), 0xFFFF00AA, string);
}
return 1;
}
return 0;
}
ERROR:
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\GiveScore.pwn(8) : error 017: undefined symbol "strtok"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\GiveScore.pwn(8) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Larsey123IsMe
Unregistered
1 ERROR Left :P
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\GiveScore.pwn(8) : error 017: undefined symbol "idx"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.