Quote:
Originally Posted by Lavamike
Quote:
Originally Posted by gamer_Z
lol if && then the player MUST BE in a shamal and andromeda at a time.....
BTW
where you have
GetPlayerVehicleID(playerid);
use
GetVehicleModel(GetPlayerVehicleID(playerid));
|
No, I thought that at first but then I thought about it more.
The goal is to only continue if they are in a shamal or a andromada.
Idk how to explain it but it makes sence when you think about it...
You could do:
pawn Код:
// I use this in a timer new tmpcar = GetPlayerVehicleID(playerid); if(!IsAShamal(tmpcar) && !IsAnAndromada(tmpcar)) return SendClientMessage(playerid,COLOR_WHITE,"You are not in a shamal or in a Andromada.");
or you could do:
pawn Код:
// I use this in a timer new tmpcar = GetPlayerVehicleID(playerid); if(IsAShamal(tmpcar) || IsAnAndromada(tmpcar)) { // Code here } else return SendClientMessage(playerid,COLOR_WHITE,"You are not in a shamal or in a Andromada.");
Both should work in theory
|
if u just use GetPlayerVehicleID(playerid); then u need
to define all andromadas and shamals frm the gamemod to somewhere...
so it knows what (server)vehicleid's those have..
ex a shamal can be placed somewhere on the map...
and it can have id 50 and another shamal can have id 421
and the MODELID of this 2 shamals will ALWAYS be 519..
btw with the && and ||
&& means that this also MUST be "done"
and || stands for "OR"..
Example:
pawn Код:
if(!dini_Exists(udb_encode(PlayerName(playerid))) && LoggedIn[playerid] == 1)// if playerfile doesn't exist AND player is logged in.
{
dini_Create(udb_encode(PlayerName(playerid)));
dini_IntSet(udb_encode(PlayerName(playerid)), "score", GetPlayerScore(playerid));
dini_IntSet(udb_encode(PlayerName(playerid)), "skin", GetPlayerSkin(playerid));
LoggedIn[playerid] = 0;
SetPlayerScore(playerid,0);
return 1;
}
if(!dini_Exists(udb_encode(PlayerName(playerid))) || LoggedIn[playerid] == 1)// if playerfile doesn't exist OR player is logged in, this could probably crash.
{
dini_Create(udb_encode(PlayerName(playerid)));
dini_IntSet(udb_encode(PlayerName(playerid)), "score", GetPlayerScore(playerid));
dini_IntSet(udb_encode(PlayerName(playerid)), "skin", GetPlayerSkin(playerid));
LoggedIn[playerid] = 0;
SetPlayerScore(playerid,0);
return 1;
}
So your "TOTAL" code will look like
pawn Код:
IsAShamal
{
switch(model)
{
case 519:return 1;
}
return 0;
}
IsAndromada
{
switch(model)
{
case 592:return 1;
}
return 0;
}
new tmpcar = GetPlayerModel(GetPlayerVehicleID(playerid));
if(!IsAShamal(tmpcar) || !IsAnAndromada(tmpcar)) return SendClientMessage(playerid,COLOR_WHITE,"You are not in a shamal or in a Andromada.");
Or u can make the code a litle more tinny:
pawn Код:
IsWantedPlane
{
switch(model)
{
case 519:return 1;
case 592:return 1;
}
return 0;
}
new tmpcar = GetPlayerModel(GetPlayerVehicleID(playerid));
if(!IsWantedPlane(tmpcar)) return SendClientMessage(playerid,COLOR_WHITE,"You are not in a shamal or in a Andromada.");