Sscanf problem.
#4

Well you taught me a little about goto so I guess I should thank you as well =/

Try this, saves using goto:

pawn Код:
dcmd_gpv(params[])
{
    new CarName[32], id, OptionalID, Color1, Color2;
    new Float: PlayerCoords[4];
    if(sscanf(params, "uddd", id, OptionalID, Color1, Color2))
    {
        if(!sscanf(params, "usid", id, CarName, Color1, Color2))
        {
            OptionalID = ReturnCarID(CarName);
        }
        else
        {
            return print("Usage: /gpv [playerid/PartOfName] [CarID/CarName] [Color 1] [Color 2]")
        }
    }
    else
    {
        if(!IsPlayerConnected(id))
        {
            return print("Player is not connected!");
        }
        if(OptionalID < 400 || OptionalID > 611)
        {
            return print("Wrong Car ID! IDs start at 400 and end at 611!");
        }
        if(Color1 < 0 || Color1 > 126 || Color2 < 0 || Color2 > 126)
        {
            return print("Wrong ColorID! Color IDs start at 0 and end at 126!");
        }
        else
        {
            GetPlayerPos(id, PlayerCoords[0], PlayerCoords[1], PlayerCoords[2]);
            GetPlayerFacingAngle(id, PlayerCoords[3]);
            CreateVehicle(OptionalID, PlayerCoords[0], PlayerCoords[1], PlayerCoords[2]+1, PlayerCoords[3], Color1, Color2, 99*999);
            SendClientMessage(id, lightblue, "Remote admin has given you a vehicle!");
            printf("Player %s (ID: %i) was given a vehicle!", GetPlayerNick(id), id);
        }
    }
    return 1;
}
Reply


Messages In This Thread
Sscanf problem. - by pulposlaw - 03.06.2009, 12:32
Re: Sscanf problem. - by Weirdosport - 03.06.2009, 14:31
Re: Sscanf problem. - by pulposlaw - 03.06.2009, 14:39
Re: Sscanf problem. - by Weirdosport - 03.06.2009, 14:44
Re: Sscanf problem. - by pulposlaw - 03.06.2009, 14:56

Forum Jump:


Users browsing this thread: 1 Guest(s)