PDA

View Full Version : ZCMD & SSCANF question


Amel_PAtomAXx
22/05/2014, 05:00 PM
What is wrong here?

CMD:teleport(playerid, params[])
{
new place; // Also tried with string (new place[8];)
if(sscanf(params, "i", place)) return SendClientMessage(playerid, 0xa9c4e4ff, "[USAGE]: /teleport [Place Number]"),
/* Also did not worked with string either*/ SendClientMessage(playerid, 0xa9c4e4ff, "1 - Unity Station | 2 - TransFender LS | 3 - WheelsArchAngels SF");
else if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, colorgrey, "<!> You're not authorized to use command.");

else if(strcmp(place,"1",true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid),1801.70 78,-1890.0776,13.1106);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 270.0);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);
SetCameraBehindPlayer(playerid);
}
else
{
SetPlayerPos(playerid, 1801.7078,-1890.0776,13.1106);
SetPlayerInterior(playerid, 0);
}
}
// rest of tp locations
return 1;
}


And here also:
- I cannot turn on vehicles owned by State

CMD:start(playerid, params[])
{
#pragma unused params
new vid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == 2)
{
if(EngineStarted[vid] == 0)
{
if(vid != INVALID_VEHICLE_ID)
{
new name[MAX_PLAYER_NAME];
if(strcmp(VehicleInfo[vid][vOwner], "State", true))
{
SendClientMessage(playerid, coloryellow, "Starting vehicle engine...");
SetTimerEx("StartingEngine", 2500, false, "i", playerid);

}
else if(GetPlayerName(playerid, name, sizeof(name)) == VehicleInfo[vid][vOwner])
{
SendClientMessage(playerid, coloryellow, "Starting vehicle engine...");
SetTimerEx("StartingEngine", 2500, false, "i", playerid);

}

else
{
SendClientMessage(playerid, colorgrey, "You don't have a keys of this vehicle.");
}

}
}
}
return 1;
}



I would also like someone to give me an example of commands like "/creategun mp5" using SSCANF and ZCMD