SA-MP Forums Archive
message get spammed - 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: message get spammed (/showthread.php?tid=144024)



message get spammed - friped93 - 25.04.2010

then i uses this command the message spamms that i unlocked it why?


Код:
dcmd_vunlock(playerid, params[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
	new file[256];
	format(file,sizeof(file),"cars/%d.cfg",GetPlayerVehicleID(playerid));
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Yellow, "FAIL: You're not in a vehicle.");
	else if(udb_hash(dini_Get(file,"OWNER")) != udb_hash(PlayerName(playerid))) return SendClientMessage(playerid, Yellow, "FAIL: You're not the owner of the vehicle.");
	else
	{
	new text[256];
	SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
  SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,0);
  	format(text,sizeof(text),"*%s picks up his keys and unlocks the vehicle",PlayerName(playerid));
	SendClientMessage(playerid, Purple, text);
	dini_IntSet(file,"LOCK",0);
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
	if(IsPlayerInRange(i,10.0,10.0,X,Y,Z))
	{
	if(playerid != i)
	{
	SendClientMessage(i, Purple, text);
	}
	}
	}
	}
	return 1;
}



Re: message get spammed - MadeMan - 25.04.2010

pawn Код:
dcmd_vunlock(playerid, params[])
{
    new file[128];
    format(file,sizeof(file),"cars/%d.cfg",GetPlayerVehicleID(playerid));
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Yellow, "FAIL: You're not in a vehicle.");
    else if(udb_hash(dini_Get(file,"OWNER")) != udb_hash(PlayerName(playerid))) return SendClientMessage(playerid, Yellow, "FAIL: You're not the owner of the vehicle.");
    else
    {
        new text[128];
        format(text,sizeof(text),"*%s picks up his keys and unlocks the vehicle",PlayerName(playerid));
        dini_IntSet(file,"LOCK",0);
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
            if(IsPlayerInRange(i,10.0,10.0,X,Y,Z))
            {
                SendClientMessage(i, Purple, text);
            }
        }
    }
    return 1;
}