Pvars -
ColdXX - 23.11.2010
I have a Derby system on my server!
Im setting a Pvar when i tp to the derby area ,like this
pawn Код:
if(!strcmp(cmd, "/derby"))
{
if(DMArea[playerid] == 1) return ShowPlayerDialog(playerid,1000,DIALOG_STYLE_MSGBOX,"TELE","Cannot teleport while at DM area","Exit","Cancel");
if(inderby[playerid] == 1) return ShowPlayerDialog(playerid,1000,DIALOG_STYLE_MSGBOX,"TELE","Cannot teleport while at a Derby area","Exit","Cancel");
inderby[playerid] = 1; PlayerDB[playerid] = 1;
HOP[playerid] = 1; SetPVarInt(playerid, "InDM", 1);
SendClientMessage(playerid,0xFF0000FF,"|-----------------------|");
SendClientMessage(playerid,lgreen,"~.:Derby Match:.~");
SendClientMessage(playerid,0xFF0000FF,"|-----------------------|");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(msg,sizeof(msg),"%s [%i] has teleported to Derby Match!~[/derby]",name,playerid);
SendClientMessageToAll(COLOR_YELLOW,msg);
DestroyVehicle(veh[playerid]);
I also have a command to be able to exit the Derby Areas
pawn Код:
if(strcmp(cmdtext,"/exitdb",true)==0)
{
if(inderby[playerid] == 1)
{
if(GetPVarInt(playerid, "InDM"))
{
SetPlayerVirtualWorld(playerid,0); SetPlayerHealth(playerid,1000000);
PlayerInDm[playerid] = 0; DMArea[playerid] = 0; HOP[playerid] = 0; inderby[playerid] = 0;
SetPlayerInterior(playerid,0);
new rand;
rand = random(8);
rand++;
switch(rand)
{
case 1: SetPlayerPos(playerid, 2090.6289,2073.8262,10.8203);
case 2: SetPlayerPos(playerid,2025.2324,1008.1907,10.8203);
case 3: SetPlayerPos(playerid,2130.3479,1332.9777,10.8263);
case 4: SetPlayerPos(playerid, 2194.6714,1677.6198,12.3672);
case 5: SetPlayerPos(playerid,2281.2207,1394.5282,42.8203);
case 6: SetPlayerPos(playerid,1319.3940,1254.9871,10.8203);
case 7: SetPlayerPos(playerid,-1363.4878,-264.2943,14.1484);
case 8: SetPlayerPos(playerid,-1528.9470,536.7141,7.1797);
case 9: SetPlayerPos(playerid,-2624.2734,1402.2373,7.1016);
}
DeletePVar(playerid, "InDM");
}
return SendClientMessage(playerid,lgreen,"Exited...");
}
else
{
return SendClientMessage(playerid,red,"You are not into a Derby area!");
}
}
With that Pvar i should disable autofixing at Derby areas,which actually works.
When i do /exitdb the autofix its still disabled!...
whats the problem?
Re: Pvars -
Zh3r0 - 23.11.2010
Rather use it this way...
if(GetPVarInt(playerid, "InDM") == 1 )
And when disabling just do 0 instead.
Re: Pvars -
ColdXX - 23.11.2010
Yea ,on exit DM right?
But i also have something at the AutofixSystem....
pawn Код:
public AutoFix() {
for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
if(IsPlayerConnected(playerid)) {
new Float:health, cid;
if (IsPlayerInAnyVehicle(playerid)) {
cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (health < 999) {
RepairVehicle(GetPlayerVehicleID(playerid));
if(GetPVarInt(playerid, "InDM"))
{
KillTimer(fix);
}
}
}
}
}
return 1;
}
fix = SetTimer("AutoFix",etc...)
Damn i hate Pvars so much!
Re: Pvars -
Zh3r0 - 23.11.2010
You don't need to kill the timer, you can just check if the player is NOT in the dm by ding what i just did.
pawn Код:
public AutoFix( )
{
for ( new playerid = 0; playerid < MAX_PLAYERS; playerid++ )
{
if ( IsPlayerConnected ( playerid ) )
{
if ( GetPVarInt(playerid, "InDM" ) == 0 )
{
new Float:health,
cid;
if ( IsPlayerInAnyVehicle ( playerid ) )
{
cid = GetPlayerVehicleID ( playerid );
GetVehicleHealth ( cid, health );
if ( health < 999 )
{
RepairVehicle ( GetPlayerVehicleID( playerid ) );
}
}
}
}
}
return 1;
Re: Pvars -
ColdXX - 23.11.2010
kay Thanks!
ADIOS! *NO sarcasm* for good!