problem with locked cars...
#1

Hi,


I have a vehicle system but there is one problem... :/
It always saying that the car is someones else... who is online...


this is my vehicles lock system

LOCK :

Quote:

if(strcmp(cmdtext, "/lock", true,9)==0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{

new vehicleid = GetPlayerVehicleID(playerid);


if(vehicleDB[vehicleid][locked]){SendClientMessage(playerid,COLOR,"Vehicle is locked."); return 1;}
new tModel = GetVehicleModel(vehicleid);
if(tModel == 486 || tModel == 588 || tModel == 582 || tModel == 571 || tModel == 424 || tModel == 420 || tModel == 559 || tModel == 504 || tModel == 545 || tModel == 539 || tModel == 515 || tModel == 528 || tModel == 403 || tModel == 437 || tModel == 448 || tModel == 437 || tModel == 424 || tModel == 574 || tModel == 525 || tModel == 446 || tModel == 416 || tModel == 433 || tModel == 427 || tModel == 421 || tModel == 400 || tModel == 477 || tModel == 490 || tModel == 407 || tModel == 544 )
{SendClientMessage(playerid,COLOR,"You can't lock this vehicle"); return 1;}
if(tModel == 537)
{SendClientMessage(playerid,COLOR,"You can't lock this vehicle"); return 1;}
if(tModel == 523 || tModel == 470 || tModel == 596 || tModel == 597 || tModel == 598 || tModel == 432 || tModel == 601 || tModel == 497 || tModel == 476 || tModel == 519 || tModel == 452 || tModel == 600 || tModel == 599 || tModel == 538 || tModel == 462 || tModel == 447 || tModel == 489 || tModel == 481 || tModel == 439 || tModel == 458 || tModel == 509 || tModel == 494 || tModel == 502 || tModel == 503 || tModel == 526 || tModel == 487 || tModel == 442 || tModel == 471 || tModel == 507)
{SendClientMessage(playerid,COLOR,"You can't lock this vehicle"); return 1;}
playerDB[playerid][pcar]=vehicleid;
vehicleDB[vehicleid][locked]=true;
GetPlayerName(playerid,vehicleDB[vehicleid][owner_name],MAX_PLAYER_NAME);
SendClientMessage(playerid,GREEN,"Car locked");
return 1;
}

and then

Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{


if(vehicleid > maxvehicles || vehicleid < 0)
{
}

if(vehicleDB[vehicleid][owner_name][locked] && !playerDB[playerid][bypass])
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(strcmp(name,vehicleDB[vehicleid][owner_name],true))
{
Stop(playerid);
ApplyAnimation(playerid, "PED", "CAR_doorlocked_LHS", 4.000000, 0, 0, 0, 0, -1);
new msg[128];
format(msg,sizeof(msg),"Vehicle locked. It belongs to %s",vehicleDB[vehicleid][owner_name]);
SendClientMessage(playerid,RED,msg);
return 1;
}

SendClientMessage(playerid,COLOR,"Be good driver");
playerDB[playerid][rbool][0]=true;
}
return 1;
}

Reply
#2

use
[pawn] .. [/pawn

use
switch

use
Zcmd
Reply
#3

could you tell me more about switch ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)