What's wrong with this command?
#5

Quote:
Originally Posted by MCZOFT
Посмотреть сообщение
Try

PHP код:
CMD:setclass(playeridparams[])
{
    new 
NewClass[24];
    if(
sscanf(params"s[24]"NewClass)) return SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}/setclass [classname]");
    if(
strcmp(NewClass"Taxi"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}{FFFFFF}You are already playing as a cab driver!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a taxi driver.");
        
SetPlayerColor(playeridCOLOR_YELLOW);
        
ResetPlayerWeapons(playerid);
        
SetPlayerArmour(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerSkin(playerid234);
        
SetPlayerPos(playerid1690.72961447.775310.7661);
        
SetPlayerFacingAngle(playerid267.7922);
        
PlayerClass[playerid] = 0;
        return 
1;
    }
    if(
strcmp(NewClass"Pilot"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 1) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}{FFFFFF}You are already playing as a pilot!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a pilot.");
        
SetPlayerColor(playeridCOLOR_CYAN);
        
ResetPlayerWeapons(playerid);
        
SetPlayerArmour(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerSkin(playerid61);
        
SetPlayerPos(playerid1319.21111256.263510.8203);
        
SetPlayerFacingAngle(playerid359.9823);
        
PlayerClass[playerid] = 1;
        return 
1;
    }
    if(
strcmp(NewClass"Paramedic"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 2) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}You are already playing as a paramedic!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a paramedic.");
        
SetPlayerColor(playeridCOLOR_RED);
        
ResetPlayerWeapons(playerid);
        
SetPlayerArmour(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerSkin(playerid275);
        
SetPlayerPos(playerid1607.50431819.692610.8280);
        
SetPlayerFacingAngle(playerid359.0171);
        
PlayerClass[playerid] = 2;
        return 
1;
    }
    if(
strcmp(NewClass"Lowlife"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 3) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}You are already playing as a lowlife!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a lowlife.");
        
SetPlayerColor(playeridCOLOR_WHITE);
        
ResetPlayerWeapons(playerid);
        
SetPlayerArmour(playerid50);
        
SetPlayerHealth(playerid100);
        
GivePlayerWeapon(playeridPISTOL256);
        
GivePlayerWeapon(playeridTEC9512);
        
SetPlayerSkin(playerid292);
        
SetPlayerPos(playerid1927.6666674.5269,  10.8203);
        
SetPlayerFacingAngle(playerid0.0902);
        
PlayerClass[playerid] = 3;
        return 
1;
    }
    if(
strcmp(NewClass"Firefighter"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 4) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}You are already playing as a firefighter!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a firefighter.");
        
SetPlayerColor(playeridCOLOR_ORANGE);
        
ResetPlayerWeapons(playerid);
        
SetPlayerArmour(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerSkin(playerid278);
        
SetPlayerPos(playerid1735.52432111.226812.2891);
        
SetPlayerFacingAngle(playerid94.0980);
        
PlayerClass[playerid] = 4;
        return 
1;
    }
    if(
strcmp(NewClass"Police"falsesizeof(NewClass)))
    {
        if(
PlayerClass[playerid] == 5) return SendClientMessage(playeridCOLOR_RED"(ERROR): {FFFFFF}You are already playing as a police officer!");
        
SendClientMessage(playeridCOLOR_GRAY"{7FAFDA}Server: {FFFFFF}You have respawned as a police officer.");
        
SetPlayerColor(playeridCOLOR_BLUE);
        
ResetPlayerWeapons(playerid);
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid100);
        
GivePlayerWeapon(playeridPISTOL256);
        
GivePlayerWeapon(playeridSHOTGUN50);
        
SetPlayerSkin(playerid282);
        
SetPlayerPos(playerid2273.67292447.46443.5313);
        
SetPlayerFacingAngle(playerid182.2979);
        
PlayerClass[playerid] = 5;
        return 
1;
    }
    return 
1;

This is the same as having them in else if statements. Same problem.
Reply


Messages In This Thread
What's wrong with this command? - by austin070 - 26.01.2014, 15:30
Re: What's wrong with this command? - by Sawalha - 26.01.2014, 15:42
Re : What's wrong with this command? - by MCZOFT - 26.01.2014, 15:44
Re: What's wrong with this command? - by Konstantinos - 26.01.2014, 15:45
Re: Re : What's wrong with this command? - by austin070 - 26.01.2014, 15:47
Re: What's wrong with this command? - by austin070 - 26.01.2014, 15:53

Forum Jump:


Users browsing this thread: 1 Guest(s)