[SOLVED] Problem With Vehicle Spawn Message - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Problem With Vehicle Spawn Message (
/showthread.php?tid=68490)
[SOLVED] Problem With Vehicle Spawn Message -
Alec24 - 10.03.2009
When a vehicle is spawned a message appears saying "<PlayerName> Spawne A Vehicle : <Vehicle>"
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[200], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/v", true, 10) == 0)
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You Diden't Give A Vehicle Name!");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "That Vehicle Name Was Not Found!");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
new pname = GetPlayerName(playerid);
format(String, sizeof(String), "%s Spawned A Vehicle : %s", pname, aVehicleNames[vehicle - 400]);
SendClientMessageToAll(l_green, String);
return 1;
}
return 0;
}
Instead it is saying something like "4*1/2admiral Spawned A Vehicle : Admiral" What is wrong?
Re: Problem With Vehicle Spawn Message -
MenaceX^ - 10.03.2009
Add
pawn Код:
GetPlayerName(playerid,pname,24);
above the format.
Re: Problem With Vehicle Spawn Message -
Alec24 - 10.03.2009
I tried it but got one error.
Код:
new pname = GetPlayerName(playerid,pname,24);
format(String, sizeof(String), "%s Spawned A Vehicle : %s", pname, aVehicleNames[vehicle - 400]);
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\filterscripts\Spawner.pwn(249) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Problem With Vehicle Spawn Message -
Alec24 - 10.03.2009
Its fine i now have it fixed using:
Код:
new pname[24];
GetPlayerName(playerid,pname,24);
format(String, sizeof(String), "%s Spawned A Vehicle : %s", pname, aVehicleNames[vehicle - 400]);