SA-MP Forums Archive
/r , /z and /setrace - 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: /r , /z and /setrace (/showthread.php?tid=271660)



/r , /z and /setrace - RoleplayEditor - 25.07.2011

Hello , Im new in Scripting and i need help...
I want to make these 3 cmds...
My gamemode is a Zombie Survival one...

/r is Radio for Humans ... ONLY HUMANS CAN USE IT...

/z is chat for Zombies ... ONLY ZOMBIES CAN USE IT ... and also if zombies try to talk without /z how can i make something which will show " You're Zombie , Stupid you cant Talk " or something like that..

/setrace is to set race of a player to zombie or Human... and its available for admins who are 10+ ( im using LuxAdmin script )


If you need anything from script to make these Cmds..I'll give u .. Please..i really need help.


Re: /r , /z and /setrace - Basicz - 25.07.2011

ZCMD + Sscanf + Foreach

pawn Код:
CMD:r( playerid, j[ ] )
{
    if ( gTeam[ playerid ] != humans )
        return // error message

    new
        szMSG[ 128 ]
    ;

    if ( sscanf( j, "s[128]", szMSG ) )
        return //error message

    foreach (Player, i)
    {
        if ( gTeam[ i ] == humans )  { new ABC[ 128 ]; format( ABC, 128, "TEAM MSG: %s", szMSG ); SendClientMessage( i, -1, ABC );
    }

    return 1;
}

CMD:setrace( playerid, j[ ] )
{
    if ( isadmin[ playerid ] < 100101010 )
        return // error message
 
    new id, team[ 24 ];

    if ( sscanf( j, "us[24]", id, team ) )
        return // error message

    if ( id == INVALID_PLAYER_ID )
        return // error message

    if ( !strcmp( team, "zombie", true ) )
        gTeam[ id ] = zombie;

    else if ( !strcmp( team, "human", true ) )
        gTeam[ id ] = human;

    else
        return // invalid parameter error

    return 1;
}
-[- Sorry accidentally posted the post -]-