29.10.2010, 20:42
Cabbie Company wants their own phone number. So i thought of making one. It didn't work out that well
So that was the /call command.
Errors are commented
Thanks in advance
Bates
pawn Код:
command(call, playerid, params[])
{
new number, string[ 128 ];
if( sscanf( params, "d", number) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /call [number]" );
}
else
{
if( Player[playerid][PhoneN] == number || Player[playerid][PhoneN] == -1)
{
SendClientMessage( playerid, WHITE, "You either don't have a phone, OR you're attempting to call yourself." );
}
else
{
if( Player[playerid][PhoneStat] == 1)
{
if( Player[playerid][CellphoneConsole] == -1)
{
if(number == 911)
{
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_USECELLPHONE);
Player[playerid][CellphoneConsole] = 911;
SendClientMessage( playerid, WHITE, "You've called Emergency services, please select the department you desire (i.e: LSPD, LSFMD)" );
}
else if(number == 444)
{
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_USECELLPHONE);
// Player[playerid][CellPhoneConsole] = 444; - error 017: undefined symbol "CellPhoneConsole" Same problem here, check at the next error
SendClientMessage( playerid, WHITE, "You called Cabbie Co. Please tell us if you need a Limo, a Cab, a Private Car or a Helicopter." );
}
else
{
// Continues here, this part is not related to what i need help with.
pawn Код:
if( Player[playerid][CellphoneConsole] != -1)
{
if( Player[playerid][CellphoneConsole] != 911)
{
format( string, sizeof( string ), "[Phone] [%s Accent] %s says: %s", Player[playerid][Accent], GetName( playerid ), text);
NearByMessage( playerid, GREY, string);
SendClientMessage( Player[playerid][CellphoneConsole], GREY, string);
ICChatLog( string );
}
// else if( Player[playerid][CellPhoneConsole] != 444) - This line: error 017: undefined symbol "CellPhoneConsole" Since the 911 system works and both includes CellPhoneConsole, something is weird here..
{
format( string, sizeof( string ), "[Phone] [%s Accent] %s says: %s", Player[playerid][Accent], GetName( playerid ), text);
NearByMessage( playerid, GREY, string);
SendClientMessage( Player[playerid][CellphoneConsole], GREY, string);
ICChatLog( string );
}
else
{
new txtstr[128];
format(txtstr, sizeof(txtstr), "[Phone] [%s Accent] %s says: %s", Player[playerid][Accent], GetName( playerid ), text);
NearByMessage( playerid, GREY, txtstr);
ICChatLog( string );
switch( Player[playerid][FourFourFourStep])
{
case 0:
{
if(!strcmp(text, "Limo", true) )
{
SendClientMessage( playerid, WHITE, "[DISPATCHER:] Ok, a limousine is being dispatched to your location" );
Player[playerid][FourFourFourStep] = 11;
}
else if(!strcmp(text, "Helicopter", true) )
{
SendClientMessage( playerid, WHITE, "[DISPATCHER:] Ok, a helicopter is being dispatched to your location." );
Player[playerid][FourFourFourStep] = 13;
}
else if(!strcmp(text, "Private car", true) )
{
SendClientMessage( playerid, WHITE, "[DISPATCHER:] Ok, a private car is being dispatched to your current location." );
Player[playerid][FourFourFourStep] = 15;
}
else if(!strcmp(text, "Cab", true) )
{
SendClientMessage( playerid, WHITE, "[DISPATCHER:] Ok, a cab is being dispatched to your location." );
Player[playerid][FourFourFourStep] = 17;
}
else
{
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
Player[playerid][CellphoneConsole] = -1;
Player[playerid][FourFourFourStep] = 0;
SendClientMessage( playerid, WHITE, "Unrecognized line. The call has been terminated." );
}
}
case 11:
{
if(IsPlayerConnectedEx(GetPlayerID(text) ) )
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone( playerid, location, MAX_ZONE_NAME);
format( string, sizeof( string ), "Taxi Call: %s has called a limousine. Pick him up at %s ", GetName( playerid ), location);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx( i ) )
{
if(Groups[Player[i][Group]][CommandTypes] == 12 && Player[i][TaxiDuty] == 1)
{
SendClientMessage(i, YELLOW, string);
}
}
}
Player[playerid][CellphoneConsole] = -1;
Player[playerid][FourFourFourStep] = 0;
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}
case 13:
{
if(IsPlayerConnectedEx(GetPlayerID(text) ) )
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone( playerid, location, MAX_ZONE_NAME);
format( string, sizeof( string ), "Taxi Call: %s has called a helicopter. Pick him up at %s ", GetName( playerid ), location);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx( i ) )
{
if(Groups[Player[i][Group]][CommandTypes] == 12 && Player[i][TaxiDuty] == 1)
{
SendClientMessage(i, YELLOW, string);
}
}
}
Player[playerid][CellphoneConsole] = -1;
Player[playerid][FourFourFourStep] = 0;
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}
case 15:
{
if(IsPlayerConnectedEx(GetPlayerID(text) ) )
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone( playerid, location, MAX_ZONE_NAME);
format( string, sizeof( string ), "Taxi Call: %s has called a private car. Pick him up at %s ", GetName( playerid ), location);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx( i ) )
{
if(Groups[Player[i][Group]][CommandTypes] == 12 && Player[i][TaxiDuty] == 1)
{
SendClientMessage(i, YELLOW, string);
}
}
}
Player[playerid][CellphoneConsole] = -1;
Player[playerid][FourFourFourStep] = 0;
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}
case 17:
{
if(IsPlayerConnectedEx(GetPlayerID(text) ) )
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone( playerid, location, MAX_ZONE_NAME);
format( string, sizeof( string ), "Taxi Call: %s has called a taxi/Cabbie. Pick him up at %s ", GetName( playerid ), location);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx( i ) )
{
if(Groups[Player[i][Group]][CommandTypes] == 12 && Player[i][TaxiDuty] == 1)
{
SendClientMessage(i, YELLOW, string);
}
}
}
Player[playerid][CellphoneConsole] = -1;
Player[playerid][FourFourFourStep] = 0;
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}
}
// under this comes the 911. 911 system works. No brackets missing, you just dont see them.
Thanks in advance
Bates