SA-MP Forums Archive
Server crashing... - 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: Server crashing... (/showthread.php?tid=264803)



Server crashing... - cloudysky - 27.06.2011

pawn Код:
command(setzombie, playerid, params[])
{
    new pID;
    if( PlayerInfo[playerid][Admin] >= 4)
    {
        if(sscanf(params, "ud", pID)) return SendClientMessage(playerid, COLOUR_WHITE, "Usage: /setzombie [Player/Name]");
        gTeam[pID] = TEAM_ZOMBIE;
        PlayerInfo[pID][Zombie] = 1;
        SetPlayerPos(pID, ZOMBIESPAWN);
        SetPlayerColor(pID, COLOUR_YELLOW);
        SendClientMessage(pID, COLOUR_WHITE, "You have been changed into a zombie by an Admin" );
        SetPlayerSkin(pID, 162);
        GivePlayerWeapon(pID, 9, 0);
    }
    return 1;
}
pawn Код:
command(test, playerid, params[])
{
    if( GetPlayerTeam(playerid) == 2)
    {
        SendClientMessage(playerid, COLOUR_YELLOW, "YOU ARE A ZOMBIE!!!" );
    }
    else
    {
        SendClientMessage(playerid, COLOUR_WHITE, "YOU ARE NOT A ZOMBIE!!!" );
    }
    return 1;
}
Thats what the command is, however when its used it crashes my server. Can anyone see whats wrong?


Re: Server crashing... - iPLEOMAX - 27.06.2011

Try this format:
pawn Код:
if(sscanf(params, "r", pID))
Read the sscanf topic again.

Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42



Re: Server crashing... - cloudysky - 27.06.2011

Nope it is still crashing


Re: Server crashing... - iPLEOMAX - 27.06.2011

One question: What type of command system are you using?


Re: Server crashing... - CrazyBlob - 27.06.2011

try dcmd or zcmd


Re: Server crashing... - Mean - 27.06.2011

pawn Код:
if( sscanf( params, "u", pID ) )
"u" is for users.
pawn Код:
SetPlayerPos( pID, ZOMBIESPAWN );
Mind showing us ZOMBIESPAWN?

Also, you are giving player a weapon with no ammo... Like you didn't even give.
So change it to:
pawn Код:
GivePlayerWeapon( pID, 9, 1 ); // Gives player one chainsaw