What's wrong here? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong here? (
/showthread.php?tid=543765)
What's wrong here? -
GBLTeam - 28.10.2014
First of all, when use the /adddealersihp to spawn an new dealership its working good, also i tried to do an GMX/Restart server and the dealership works fine, but what about /deletedealership it says Invalid ID.
Here its /adddealership
pawn Код:
CMD:adddealership(playerid, params[])
{
if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "You are not an Admin!");
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be spawned to use this command!");
for(new i=1; i < MAX_DEALERSHIPS; i++)
{
if(!DealershipCreated[i])
{
new msg[128];
DealershipCreated[i] = 1;
GetPlayerPos(playerid, DealershipPos[i][0], DealershipPos[i][1], DealershipPos[i][2]);
UpdateDealership(i, 0);
SaveDealership(i);
format(msg, sizeof(msg), "Added Dealership with ID: %d", i);
SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
return 1;
}
}
SendClientMessage(playerid, COLOR_GREY, "You cannot add more dealerships!");
return 1;
}
Here its /deletedealership
pawn Код:
CMD:deletedealership(playerid, params[])
{
if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi Admin!");
new dealerid, msg[128];
if(sscanf(params, "u", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /deletedealership [ID]");
if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid ID!");
for(new i=1; i < MAX_DVEHICLES; i++)
{
if(VehicleCreated[i] == VEHICLE_DEALERSHIP && strval(VehicleOwner[i]) == dealerid)
{
DestroyVehicle(VehicleID[i]);
Delete3DTextLabel(VehicleLabel[i]);
VehicleCreated[i] = 0;
}
}
DealershipCreated[dealerid] = 0;
Delete3DTextLabel(DealershipLabel[dealerid]);
SaveDealership(dealerid);
format(msg, sizeof(msg), "Deleted Dealership with ID %d", dealerid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
return 1;
}
Re: What's wrong here? -
Jefff - 28.10.2014
"u" means playerid/part of name, change to "i"
Re: What's wrong here? -
Blademaster680 - 28.10.2014
Код:
IsValidDealership(dealerid)
Can you please send us this function's code.
There might be a problem in there that is causing it to not work properly
Re: What's wrong here? -
GBLTeam - 29.10.2014
Quote:
Originally Posted by Jefff
"u" means playerid/part of name, change to "i"
|
This helped me, thanks now it work
![Smiley](images/smilies/smile.png)
Cheers!