Is there something wrong in this code? - 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)
+--- Thread: Is there something wrong in this code? (
/showthread.php?tid=619242)
Is there something wrong in this code? -
NealPeteros - 15.10.2016
When I compile it, PAWN Compiler stops. What seems to be the problem?
PHP код:
forward WolfShapeshift(playerid);
public WolfShapeshift(playerid);
{
if(isWolf[playerid] == 0)
{
new randomID = random(200);
new string[60];
isWolf[playerid] = true;
GetPlayerName(playerid, string, sizeof(string));
strmid(OldUsername[playerid], string, 0, strlen(string), 64);
OldSkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, 0);
format(string,sizeof(string), "Werewolf", randomID);
SetPlayerName(playerid, string);
format(string, sizeof(string), "* %s shapeshifts into a werewolf.", OldUsername[playerid]);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
return 1;
}
This is where the timer "WolfShapeshift" is called.
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_YES))
{
if(isWolf[playerid] == 0)
{
new string[100];
format(string, sizeof(string), "* %s growls softly as he begins to shapeshift into a werewolf.", RPName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SCM(playerid, COLOR_FADE1, "You will now be shapeshifted into a werewolf by 5 seconds.");
SetTimerEx("WolfShapeshift", 5000, false, "i", playerid);
}
else
{
new string[100];
format(string, sizeof(string), "* %s growls softly as he begins to shapeshift back into a human.", RPName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SCM(playerid, COLOR_FADE1, "You will now be shapeshifted back into a human by 5 seconds.");
SetTimerEx("HumanShapeshift", 5000, false, "i", playerid);
}
}
return 1;
}
Re: Is there something wrong in this code? -
Konstantinos - 15.10.2016
Код:
public WolfShapeshift(playerid);
Remove semicolon from there.
Re: Is there something wrong in this code? -
NealPeteros - 15.10.2016
Oops didn't see that
Re: Is there something wrong in this code? -
NealPeteros - 28.10.2016
-Fixed-