How to add a code into a gamemode? need help - 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: How to add a code into a gamemode? need help (
/showthread.php?tid=545662)
How to add a code into a gamemode? need help -
Samieastwood - 09.11.2014
so basically i want to add a code into my gamemode , How could i make it work?
for exampe this
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new MSG[250];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if (strcmp("/greet", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pCop] == 1){
if(PlayerToPlayer(playerid,5, 10.0)){
format(MSG,sizeof(MSG),"Hello, I'm %s [Police Officer] with the Los Santos Police Department. Do you know why I stopped you today?", Name);
SendClientMessage(playerid, COLOR_WHITE, MSG);{
return 1;
}
return 0;
}
stock PlayerToPlayer(playerid, targetid, Float:distance)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z))
{
return true;
}
return false;
}
Re: How to add a code into a gamemode? need help -
k0r - 09.11.2014
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new MSG[250];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if (strcmp("/greet", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pCop] == 1){
if(PlayerToPlayer(playerid,5, 10.0))
{
format(MSG,sizeof(MSG),"Hello, I'm %s [Police Officer] with the Los Santos Police Department. Do you know why I stopped you today?", Name);
SendClientMessage(playerid, COLOR_WHITE, MSG);
}
}
return 1;
}
return 0;
}
stock PlayerToPlayer(playerid, targetid, Float:distance)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z))
{
return true;
}
return false;
}
Re: How to add a code into a gamemode? need help -
Quickie - 09.11.2014
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new MSG[250];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if (strcmp("/greet", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pCop] == 1)
{
for(new i;i!=MAX_PLAYERS;i++)
{
if(playerid==i)continue;
if(IsPlayerConnected(i))
{
if(PlayerToPlayer(playerid,i, 10.0))
{
format(MSG,sizeof(MSG),"Hello, I'm %s [Police Officer] with the Los Santos Police Department. Do you know why I stopped you today?", Name);
SendClientMessage(i, COLOR_WHITE, MSG);
SendClientMessage(playerid, COLOR_WHITE, MSG);
}
}
}
}
return 1;
}
return 0;
}