Convert to if(strcmp)
#1

Can anyone convert this:

Код:
CMD:parkmeter(playerid, params[])
{
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You are not in a vehicle");
   if(!IsPlayerInRangeOfParkMeter(playerid)) return SendClientMessage(playerid, -1, "You are not near a park meter");
   new minute;
   if(sscanf(params, "i", minute)) return SendClientMessage(playerid, -1, "USAGE: /parkmeter [minutes]");
   if(minute <= 0) return SendClientMessage(playerid, -1, "The minutes need to be more than 1");
   GivePlayerMoney(playerid, -minute);
   return 1;
}

stock IsPlayerInRangeOfParkMeter(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 2, 2227.3281,1655.5314,961.7531)) return 1; 
    else if(IsPlayerInRangeOfPoint(playerid, 2, 2228.5593,1651.2610,961.7596)) return 1;
    return 0;
}
//put ur own cords and radius
and also can you define each symbol, do it and I'll +REP.
Reply
#2

I am doing it. When i am done, i will PM you.

Regards.

EDIT:
pawn Код:
//put on top of the script:
#define grey 0xAFAFAFAA
#define red 0xAA3333AA
#define yellow 0xFFFF00AA
#define green 0x22EE17FF


//put under OnPlayerCommandText(playerid, cmdtext) :

if(strcmp(cmdtext,"/parkmeter",true))//the command
{
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "You are not in a vehicle"); //check if selected player is in vehicle
   if(!IsPlayerInRangeOfParkMeter(playerid)) return SendClientMessage(playerid, red, "You are not near a park meter");//check if the player is near a parkmeter in the "stock IsPlayerInRangeOfParkMeter(playerid)"
   new minute;
   if(sscanf(params, "i", minute)) return SendClientMessage(playerid, yellow, "USAGE: /parkmeter [minutes]");
   if(minute <= 0) return SendClientMessage(playerid, yellow, "The minutes need to be more than 1");
   GivePlayerMoney(playerid, -minute);
   return 1;
}

//put anywhere in your script:
stock IsPlayerInRangeOfParkMeter(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 2, 2227.3281,1655.5314,961.7531)) return 1; //remember to set your own coordinates here, this is checking if the player is in range of a given point.
    else if(IsPlayerInRangeOfPoint(playerid, 2, 2228.5593,1651.2610,961.7596)) return 1;// Same here:
    //else if else if(IsPlayerInRangeOfPoint(playerid, 2, 2228.5593,1651.2610,961.7596)) return 1; //just add more like this...
    return 0;
}
//remember to put own coordinates and Radius in the "IsPlayerInRangeOfPoint" statements.
Any errors, please tell me and i will help you fix them fast via PM.
Reply
#3

+REPed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)